package com.template.mapper;

import com.template.dto.GroupMessage;
import com.template.dto.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface MessageMapper {

    @Select("select * from user where id=#{id}")
    User selectById(Integer id);

    @Insert("insert into groupmessage(id,name,imageUrl,message,createTime) values (#{id},#{name},#{imageUrl},#{message},#{createTime})")
    void insertMessage(GroupMessage groupMessage);

    @Select("select * from groupmessage order by num")
    List<GroupMessage> getAllGoupMessage();

    @Update("update groupmessage set name=#{name},imageUrl=#{imageUrl} where id=#{id}")
    void editMessage(User user);
}
